<template>
	<view>
		<view class="header status_bar" :class="scrrol == true ? 'scrrolHeader' : ''">
			<view class="back iconfont icon-xiangzuo1" @tap="backPage" :class="scrrol == true ? 'scrrolHeader02' : ''"></view>
			<view class="text" :class="scrrol == true ? 'scrrolHeader' : ''">详情</view>
		</view>
		<view class="bg_box">
			<view class="clear_box"></view>
			<image class="bg01" :src="image" mode="widthFix"></image>
			<view class="bg_content">
				<view class="product_box">
					<view class="title">{{info.title}}</view>
					<view class="tag_box">
						<block v-for="(item, index) in tags" :key="'tags' + index">
							<view class="tag">{{item}}</view>
						</block>
					</view>
					<view class="time_box">
						<view class="time">发布：{{info.publish_time}}</view>
						<view class="volume">已售 {{info.virtual_sales}}+</view>
					</view>
				</view>

				<view class="message_box">
					<view class="title">商品信息</view>
					<view class="content_box" v-html="content">
						
					</view>
					<!-- <view class="menu_box">
						<view class="menu">
							<view class="num">2023-09</view>
							<view class="text">上牌时间</view>
						</view>
						<view class="menu">
							<view class="num">3.3万公里</view>
							<view class="text">表显里程</view>
						</view>
						<view class="menu">
							<view class="num">白色</view>
							<view class="text">外观颜色</view>
						</view>
					</view>
					<view class="other_box">
						<view class="other">
							<view class="o">排量</view>
							<view class="o">1.5T</view>
						</view>
						<view class="other">
							<view class="o">变速箱</view>
							<view class="o">自动</view>
						</view>
						<view class="other">
							<view class="o">排放标准</view>
							<view class="o">国VI</view>
						</view>
						<view class="other">
							<view class="o">厂家类型</view>
							<view class="o">合资</view>
						</view>
						<view class="other">
							<view class="o">车辆类型</view>
							<view class="o">紧凑型suv</view>
						</view>
						<view class="other">
							<view class="o">能源类型</view>
							<view class="o">汽油</view>
						</view>
					</view> -->
				</view>

				<view class="message_box">
					<view class="title">商品描述</view>
					<view class="description">
					<view class="content_box" v-html="description">
						
					</view>
					</view>
				</view>

				<view class="message_box">
					<view class="title">商品实拍</view>
					<view class="message_img">
						<block v-for="(item, index) in images" :key="'images' + index">
							<image class="real" :src="item" mode="widthFix"></image>
						</block>
					</view>
				</view>
				<view class="clear_box04"></view>
			</view>
		</view>
		
		
		<view class="confirm" :data-url="'/pages/goods/submit?o_id='+info.id" @click="gotopage">我要购买</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				page: 1,
				scrrol: false,
				info: '',
				id:0,
				tags:[],
				content:'',
				image:'',
				description:'',
				images:[],
			}
		},
		onLoad(e) {
			let that = this;
			that.id = e.id;
			that.loadData();
		},
		methods: {
			loadData() {
				let that = this;
				that.Net._get('index/system_detail', {id:that.id}, res => {
					if (res.code == 200) {
						that.info = res.data;
						that.tags = res.data.tags;
						that.content = res.data.detail;
						that.image = res.data.master_image;
						that.images = res.data.images;
						that.description = res.data.description;
					}
				});
			},
			backPage() {
				uni.navigateBack({});
			},
			gotopage(e) {
				let url = e.currentTarget.dataset.url;
				uni.navigateTo({
					url: url
				});
			},

		},
		onPageScroll: function(Object) {
			//console.log(Object.scrollTop); //实时获取到滚动的值
			if (Object.scrollTop > 28) {
				this.scrrol = true;
				/* #ifdef APP-PLUS */
				/* #endif */
			} else if (Object.scrollTop < 28) {
				this.scrrol = false;
				/* #ifdef APP-PLUS */
				/* #endif */
			}
		},
		onReachBottom() {
			var that = this;
			that.page++;
			// that.Net._get('shop_goods', {per_page:'10',page:that.page,}, res => {
			//   if (res.code == 200) {
			//     //console.log(res)
			//     if (res.data.data == '') {
			//       uni.showToast({
			//         title: '已经是最后一页了',
			//         duration: 2000,
			//         icon: 'none'
			//       });
			//     } else {
			//       that.info = that.info.concat(res.data.data); //将数据拼接在一起
			//     }
			//   } else if (res.code == 0) {
			//     that.Msg.Success(res.msg, res => {});
			//   }
			// });
		},
	}
</script>

<style>
	.header {
		background-color: transparent !important;
	}

	.header .text {
		background-color: transparent !important;
		color: #333;
	}
	
	.header .back {
		color: #333; 
	}

	.scrrolHeader {
		background-color: #FF7701 !important;
		color: #fff !important;
	}
	
	.scrrolHeader02 {
		color: #fff !important;
	}

	.bg_box {
		width: 100%;
		position: relative;
	}

	.bg_box .bg01 {
		width: 100%;
	}

	.bg_box .bg_content {
		width: 100%;
		position: absolute;
		left: 0;
		top: calc(53vh + var(--status-bar-height));
		z-index: 98;
		background-color: #F8F8F8;
		border-radius: 3vw 3vw 0 0;
		padding: 4%;
	}

	.product_box {
		width: 100%;
		margin: 0 auto;
		background-color: #fff;
		border-radius: 3vw;
		padding: 4%;
	}

	.product_box .title {
		font-size: 5vw;
		color: #333;
		font-weight: bold;
		line-height: 7vw;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
	}

	.product_box .tag_box {
		width: 100%;
		display: flex;
		align-items: center;
		margin-top: 1vw;
	}

	.product_box .tag_box .tag {
		height: 6vw;
		line-height: 6vw;
		padding: 0 1.5vw;
		border-radius: 1vw;
		font-size: 2.8vw;
		margin-left: 1vw;
		background-color: #F7F8FD;
		color: #222222;
	}

	.product_box .tag_box .tag:nth-child(1) {
		margin-left: 0;
	}

	.product_box .tag_box .tag:nth-child(1) {
		background-color: #FDF1C2;
		color: #BC8519;
	}

	.product_box .tag_box .tag:nth-child(2) {
		background-color: #FEEFEC;
		color: #DB2114;
	}

	.product_box .tag_box .tag:nth-child(3) {
		background-color: #F7F8FD;
		color: #222222;
	}

	.product_box .time_box {
		width: 100%;
		padding-top: 4%;
		border-top: 1px solid #F1F2F5;
		display: flex;
		align-items: center;
		margin-top: 4%;
	}

	.product_box .time_box .time {
		font-size: 3.2vw;
		color: #979AA9;
		flex: 1;
	}

	.product_box .time_box .volume {
		font-size: 3.2vw;
		color: #979AA9;
		flex: 1;
		text-align: right;
	}

	.message_box {
		width: 100%;
		margin: 4% auto 0;
		background-color: #fff;
		border-radius: 3vw;
		padding: 4%;
	}

	.message_box .description {
		width: 100%;
		font-size: 3.5vw;
		margin-top: 4%;
		color: #333;
		line-height: 6vw;
	}
	
	.message_box .message_img{
		width: 100%;
		margin-top: 4%;
	}
	
	.message_box .message_img image{
		width: 100%;
	}

	.message_box .title {
		font-size: 5vw;
		color: #333;
		font-weight: bold;
	}

	.message_box .menu_box {
		width: 100%;
		background-color: #FDF8F6;
		padding: 4vw 0;
		border: 1px solid #FFB599;
		display: flex;
		align-items: center;
		border-radius: 3vw;
		margin-top: 4vw;
	}

	.message_box .menu_box .menu {
		flex: 1;
	}

	.message_box .menu_box .menu .num {
		font-size: 4vw;
		font-weight: bold;
		color: #333;
		text-align: center;
	}

	.message_box .menu_box .menu .text {
		font-size: 3.5vw;
		color: #606470;
		text-align: center;
		margin-top: 2vw;
	}

	.other_box {
		margin-top: 4%;
		display: flex;
		flex-direction: row;
		justify-content: left;
		flex-wrap: wrap;
	}

	.other_box::after {
		flex: auto;
		content: '';
	}

	.other_box .other {
		width: 44%;
		margin-left: 12%;
		display: flex;
		align-items: center;
		margin-top: 3vw;
	}

	.other_box .other:nth-child(2n + 1) {
		margin-left: 0;
	}

	.other_box .other .o {
		flex: 1;
		font-size: 3.5vw;
	}

	.other_box .other .o:nth-child(1) {
		color: #8B8C9F;
	}

	.other_box .other .o:nth-child(2) {
		color: #1E2128;
	}
	
	.content_box{
		margin-top: 5vw;
	}
	
	.real{
		margin-bottom: 1vw;
	}
</style>